/*
* ============================================================================================================================================================
*
* file name: sw_time
* description: 
* created: 2019/3/10 1:26:00
*
* author: sun (sunzhongguan1989@163.com)
* company: ceno-soft (www.ceno-soft.com / www.ceno-soft.net)
*
* compiler: visual studio 2017
* CLR Version: 4.0.30319.42000
*
* ============================================================================================================================================================
*/

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace common {
    public class sw_time {
        private readonly Stopwatch sw;

        /// <summary>
        /// create a watch and start it
        /// </summary>
        public sw_time() {
            sw = new Stopwatch();
            sw.Start();
        }

        /// <summary>
        /// stop watch and return elapsedmilliseconds
        /// </summary>
        /// <returns></returns>
        public int get_time() {
            sw.Stop();
            return (int)sw.ElapsedMilliseconds;
        }
    }
}
